<script setup lang="ts">
import Versions from './components/Versions.vue'

const ipcHandle = () => {
  window.electron.ipcRenderer.send('ping')
  window.electron.ipcRenderer.send('size', { width: 1000, height: 1000 })
}
const close = () => {
  window.electron.ipcRenderer.send('close')
}
const save = () => {
  window.electron.ipcRenderer.send('save', { name: '孙小双', age: 18 })
}
const redis = () => {
  window.electron.ipcRenderer.send('redis', { name: '李晓然', age: 23 })
}
</script>

<template>
  <img alt="logo" class="logo" src="./assets/logo.svg" />
  <div class="creator">Powered by electron-vite</div>
  <div class="text">
    Build an Electron app with
    <span class="vue">Vue</span>
    and
    <span class="ts">TypeScript</span>
  </div>
  <p class="tip">Please try pressing <code>F12</code> to open the devTool</p>
  <div class="actions">
    <div class="action">
      <a href="https://electron-vite.org/" target="_blank" rel="noreferrer">Documentation</a>
    </div>
    <div class="action">
      <a target="_blank" rel="noreferrer" @click="ipcHandle">Send IPC</a>
    </div>
    <div class="action">
      <a target="_blank" rel="close" @click="close">关闭</a>
    </div>
    <div class="action">
      <a target="_blank" rel="save" @click="save">保存</a>
    </div>
    <div class="action">
      <a target="_blank" rel="redis" @click="redis">连接redis</a>
    </div>
  </div>
  <Versions />
</template>
